Update an existing Function’s description and configuration. The request must include lastUpdateTimestampMs, which is the timestamp value obtained from a previous create or get response. The response includes a URL (uploadPutUrl) for uploading new code. After uploading, call POST /functions/{name}/deploy for the changes to be applied.
Rate limit: 100 requests/min (learn more about rate limits here).
To use this endpoint, select Write Functions under the Functions category when creating or editing an API token. Learn More.
Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team.
curl --request PATCH \
--url https://api.samsara.com/functions/{name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lastUpdateTimestampMs": 1609459200000,
"config": {
"handler": "index.handler",
"isScheduleEnabled": false,
"params": {
"region": "us-west",
"threshold": "100"
},
"secrets": {
"API_KEY": "my-secret-value"
}
},
"description": "Processes incoming telemetry data."
}
'{
"data": {
"lastUpdateTimestampMs": 1609459200000,
"name": "my-function",
"updatedAtTime": "2021-01-01T00:00:00Z",
"uploadPutUrl": "https://example.com/upload?token=..."
}
}Documentation Index
Fetch the complete documentation index at: https://samsara-showcase.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The name of the Function to update.
Request body for updating a Function.
Timestamp of the last known update to this Function, obtained from a create or get response. Required to prevent conflicting updates.
1609459200000
Configuration fields to update on the Function. All fields are optional; only provided fields are updated.
Show child attributes
A description of the Function.
"Processes incoming telemetry data."
OK response.
Details of an updated Function, including a URL for uploading a new code package. After uploading, call the deploy endpoint for the changes to be applied.
Show child attributes
curl --request PATCH \
--url https://api.samsara.com/functions/{name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lastUpdateTimestampMs": 1609459200000,
"config": {
"handler": "index.handler",
"isScheduleEnabled": false,
"params": {
"region": "us-west",
"threshold": "100"
},
"secrets": {
"API_KEY": "my-secret-value"
}
},
"description": "Processes incoming telemetry data."
}
'{
"data": {
"lastUpdateTimestampMs": 1609459200000,
"name": "my-function",
"updatedAtTime": "2021-01-01T00:00:00Z",
"uploadPutUrl": "https://example.com/upload?token=..."
}
}